package mylibrary.couchDB;

import java.sql.Clob;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class DB2 {

	public static void main(String[] args) throws Exception {

		Class.forName("com.ibm.db2.jcc.DB2Driver");
		
		
		Connection conn = DriverManager.getConnection("jdbc:db2://127.0.0.1:50042/EEP12ST", "streden", "passw0rd");
		
		System.out.println(conn.getCatalog());
		
		System.out.println(conn.getMetaData().getDatabaseProductName());
		
		
		
		
		Statement st = conn.createStatement();
		
		
		//ResultSet rs = st.executeQuery("select PAYMENT_CARD_ID, ENCRYPTED_DATA, USED_CVV from EORDER.PAYMENT_CARD order by PAYMENT_CARD_ID");
		
		ResultSet rs1 = st.executeQuery("select name from sysibm.systables where type='T' and creator='DB2ADMIN'");
		
		System.out.println(rs1);
		 
		System.out.println(111);
		while(rs1.next()) {
			System.out.println(rs1.getString("name"));
		}
		System.out.println(222);

//		while(rs.next()) {
//			int id = rs.getInt("PAYMENT_CARD_ID");
//			
//			byte[] data = rs.getBytes("ENCRYPTED_DATA");
//			
//			//System.out.println(rs.getClob("ENCRYPTED_DATA"));
//			int cvv = rs.getInt("USED_CVV");
//			
//			System.out.print(id+" ");
//			System.out.print(data.length+" ");
//			System.out.print(cvv);
//			System.out.println();
//		}
		
		
	}
}
